<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
	href="http://code.jquery.com/ui/1.10.3/themes/sunny/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css" />
<script type="text/javascript"
	src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#qnaTitle").focus();
		
	
		// 공란 체크
		$("#writeQnaForm").submit(function(){
			if($("#qnaTitle").val()==""){
				alert("문의 제목을 입력하세요.");
				$("#qnaTitle").focus();
				return false;
			}else if($("#qnaContent").val()==""){
				alert("문의 내용을 입력하세요");
				$("#qnaContent").focus();
				return false;
			}else if($("#qnaAuthor").val()==""){
				alert("먼저 로그인하세요.");
				location.href="loginPage.killer";
			}
		});
		
	});
</script>
</head>
<body>
<c:choose>
	<c:when test="${sessionScope.mvo==null && sessionScope.avo==null }">
		<script type="text/javascript">
			alert("먼저 로그인하세요.");
			location.href="loginPage.killer";
		</script>
	</c:when>
	<c:when test="${sessionScope.mvo==null && sessionScope.avo!=null }">
		<script type="text/javascript">
			if(confirm("관리자가 문의 글을 쓸 수가 없습니다.\n로그아웃하시겠습니까?")){
				location.href="logoutAdmin.killer";
			}
		</script>
	</c:when>
	<c:otherwise>
		<form action="writeQna.killer" method="post" id="writeQnaForm">
			<table border="1" width="800">
			<tr>
				<td >
					<b>문의 제목: </b>
					<input type="text" id="qnaTitle" name="qnaTitle" size="80">
					<b>글쓴이 아이디: </b>
					${sessionScope.mvo.memberId }
					<input type="hidden" name="qnaAuthor" value="${sessionScope.mvo.memberId }">
				</td>
			</tr>
			<tr>
				<td>
					<b>문의 내용: </b><br>
				</td>
			</tr>
			<tr>
				<td align="center">
					<textarea rows="30" cols="90" style="resize: none" id="qnaContent" name="qnaContent"></textarea>
				</td>
			</tr>
		</table>
		<input type="submit" value="문의하기">
		</form>
	</c:otherwise>
</c:choose>


</body>
</html>

















